#ifndef _RCC_EDITOR_IO_H_
#define _RCC_EDITOR_IO_H_

#include <stdio.h>

/**
 * @brief copy a part of bytes to another file.
 * 
 * @param src the source file.
 * @param origin the origin position to copy.
 * @param end the end position to copy.
 * @param out the output stream pointer.
 *
 * @return 0 upon success, nozero value otherwise.
 */
int copy_part(FILE *src, long origin, long end, FILE *out);
/**
 * @brief write an integer to file.
 *
 * @param out the output stream pointer.
 * @param num the integer to be written.
 * @param le 1 for little-endian and 0 upon big-endian.
 *
 * @return 0 upon success, nozero value otherwise.
 */
int write_int(FILE *out, int num, int le); 
int write_short(FILE *out, short num, int le);
int reverse_int32(int int32);
short reverse_int16(short int16);
#endif
